<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app"></div>
  <!-- 1.引入依赖 -->
  <script src="../react/react.development.js"></script>
  <script src="../react/react-dom.development.js"></script>
  <script src="../react/babel.min.js"></script>
  <!-- 2.开始开发 -->
  <script type="text/babel">
    // 电影列表展示
    class App extends React.Component{
      constructor() {
        super()
        
        this.state = {
          message: 'hello world',
          movies: ['流浪地球', '隐秘的角落', '唐人街探案', '烈日灼心']
        }
      }

      render() {
        const liArray = []
        for (const item of this.state.movies) {
          liArray.push(<li>{item}</li>)
        }

        return (
          <div>
            <h2>电影列表一</h2>  
            <div>{liArray}</div>
            <h2>电影列表二</h2>  
            <div>{
              this.state.movies.map(item => {
                return <li>{item}</li>
              })
            }</div>
          </div>
        )
      }
    }



    ReactDOM.render(<App/>, document.getElementById('app'))
    // ReactDOM.render(HTML元素|组件, 挂载到哪一个HTML元素上)
  </script>
</body>

</html>